package com.yuyou.fn.platform.service.impl;

import com.github.wens.framework.service.impl.SuperServiceImpl;
import com.github.wens.mybatisplus.examples.Example;
import com.github.wens.mybatisplus.plugins.Page;
import com.yuyou.fn.common.util.CriteriaUtils;
import com.yuyou.fn.platform.entity.SysUserDetail;
import com.yuyou.fn.platform.mapper.SysUserDetailMapper;
import com.yuyou.fn.platform.permission.DataPermission;
import com.yuyou.fn.platform.service.ISysUserDetailService;
import com.yuyou.fn.platform.vo.SysUserDetailQueryVo;
import org.springframework.stereotype.Service;

/**
 *
 * SysUserDetail 表数据服务层接口实现类
 *
 */
@Service
public class SysUserDetailServiceImpl extends SuperServiceImpl<SysUserDetailMapper, SysUserDetail,String> implements ISysUserDetailService {

    @Override
    public Page<SysUserDetail> findSysUserDetailByQueryForPage(SysUserDetailQueryVo sysUserDetailQueryVo, DataPermission dataPermission, int pageNo, int pageSize) {
        Example<SysUserDetail> example = SysUserDetail.createExample();
        example.orderBy("createTime").desc() ;
        Example.Criteria criteria = example.createCriteria();
        CriteriaUtils.fillCondition(criteria,sysUserDetailQueryVo);
        //只有誉优公司才能管理系统用户
        if(dataPermission.getUserType() != 0 ){
            criteria.andCondition(" 1 <> 1");
        }
        return findPageByExample(example,pageNo , pageSize );
    }
}